package com.netease.api.post;

import java.io.Serializable;

import org.framework.common.ext.util.JsonUtil;

import com.fasterxml.jackson.annotation.JsonAutoDetect;

@JsonAutoDetect
public class NIMResponse implements Serializable {

	/** serialVersionUID(long):. */
	private static final long serialVersionUID = 1374915027107128344L;

	private String msg;
	
	private Integer code;
	
	private NIMObject obj;
	
	@JsonAutoDetect
	public class NIMObject implements Serializable {
		/** serialVersionUID(long):. */
		private static final long serialVersionUID = 8100878985423117325L;

		private String session;
		private String calleeDisplay;
		private String callerDisplay;

		public String getSession() {
			return session;
		}

		public void setSession(String session) {
			this.session = session;
		}

		public String getCalleeDisplay() {
			return calleeDisplay;
		}

		public void setCalleeDisplay(String calleeDisplay) {
			this.calleeDisplay = calleeDisplay;
		}

		public String getCallerDisplay() {
			return callerDisplay;
		}

		public void setCallerDisplay(String callerDisplay) {
			this.callerDisplay = callerDisplay;
		}
	}
	
	public NIMResponse() {

	}
	
	public NIMResponse(String json) {
		try{
			NIMResponse res = JsonUtil.getBean(json, this.getClass());
			this.msg = res.msg;
			this.obj = res.obj;
			this.code = res.code;
		}catch(Exception e){
			e.printStackTrace();
			this.code = 400;
			this.msg = json;
			this.obj = new NIMObject();
		}
	}

	public String getMsg() {
		return msg;
	}

	public void setMsg(String msg) {
		this.msg = msg;
	}

	public Integer getCode() {
		return code;
	}

	public void setCode(Integer code) {
		this.code = code;
	}

	public NIMObject getObj() {
		return obj;
	}

	public void setObj(NIMObject obj) {
		this.obj = obj;
	}

}
